<?php

declare (strict_types = 1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://doc.hyperf.io
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
 */

namespace HyperfTest\Cases;

use HyperfTest\HttpTestCase;

/**
 * @internal
 * @coversNothing
 */
class ArticleTest extends HttpTestCase {
    public function testCreate() {
        $token = $this->getToken('account', '1');
        $rt = $this->post('/article', [
            'title' => 'test title',
            'content' => 'test content',
        ], [
            'Authorization' => "Bearer {$token}",
        ]);
        $this->assertTrue(isset($rt['data']) && $rt['data']['id'] > 0);
    }
    public function testGetById() {
        $token = $this->getToken('account', '1');
        $rt = $this->get('/getById', [], [
            'Authorization' => "Bearer {$token}",
        ]);
        $this->assertTrue(isset($rt['data']['article']['title']));
    }
}
